/** 预设固定参数、函数等 */

/** 混合指令 */
// 弹性布局
// 参数：方向、换行、水平、垂直
@mixin u-flex($direction: row, $wrap: nowrap, $jc: flex-start, $ai: center) {
  display: flex;
  display: -webkit-flex;
  flex-direction: $direction;
  flex-wrap: $wrap;
  justify-content: $jc;
  align-items: $ai;
}

// 渐变，角度
@mixin u-gradient($c1, $c2, $deg) {
  background: -webkit-linear-gradient($deg, $c1, $c2); /* Safari 5.1 - 6.0 */
  background: -o-linear-gradient($deg, $c1, $c2); /* Opera 11.1 - 12.0 */
  background: -moz-linear-gradient($deg, $c1, $c2); /* Firefox 3.6 - 15 */
  background: linear-gradient($deg, $c1, $c2); /* 标准的语法 */
}

// 文本缩略
@mixin u-ellipsis() {
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

// 全局遮罩
@mixin u-modal($zIndex: 444, $bg: rgba(0, 0, 0, 0.5)) {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: $bg;
  z-index: $zIndex;
}

// 不允许选择
@mixin not-select() {
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  user-select: none !important;
}

@mixin u-button() {
  position: relative;
  margin: 0;
  padding: 0;
  display: inline-block;
  line-height: 1;
  background: 0 0;
  cursor: pointer;
  user-select: none;
  outline: 0;
  border: none;
  white-space: nowrap;
}

// 雪碧图定位 src:图片位置，w:原始宽度, x/y:相对位置
// 必需定义图片的宽高
@mixin u-img-position($src, $w, $x, $y, $h: auto) {
  background: url($src) no-repeat $x $y;
  background-size: $w $h;
  overflow: hidden;
}
